<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <title>Serverless Loan Broker Application</title>
    <link rel="stylesheet" href="/webjars/bootstrap/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css">
</head>
<body>
<div class="sticky-top d-flex justify-content-center align-items-center" aria-live="polite" aria-atomic="true">
    <div id="notificationPanel" style="position: absolute; top: .5rem;"></div>
</div>

<div class="container-fluid">
    <h1>Serverless Loan Broker Application</h1>

    <p>Use the 'Refresh' button to update the grids below.</p>

    <div style="margin-bottom: .5rem">
        <button id="refreshButton" type="button" class="btn btn-success">
            <span class="fas fa-sync"></span> Refresh
        </button>
        <button id="askNewLoan" type="button" class="btn btn-primary">
            <span class="fas fa-play"></span> Ask For Loan
        </button>
    </div>

    <h2>Pending Loan Requests</h2>
    <table class="table table-borderless table-striped" id="pendingLoans">
        <!-- Filled in by app.js -->
    </table>

    <h2>Completed Loan Requests</h2>
    <table class="table table-borderless table-striped" id="completedQuotes">
        <thead class="thead-dark">
        <tr>
            <th scope="col">#Workflow Id</th>
            <th scope="col">SSN</th>
            <th scope="col">Term</th>
            <th scope="col">Amount</th>
            <th scope="col">Score</th>
            <th scope="col">History</th>
        </tr>
        </thead>
        <tbody></tbody>
        <!-- Filled in by app.js -->

    </table>
</div>

<div class="modal fade" id="newLoanForm" tabindex="-1" aria-labelledby="newLoanFormLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="newLoanFormLabel">Request a new Loan</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <label for="txtSSN" class="col-form-label">SNS:</label>
                        <input class="form-control" id="txtSSN" type="text" placeholder="enter a social security number in the format 123-45-6789"/>
                        <label for="txtTerm" class="col-form-label">Term:</label>
                        <input class="form-control" id="txtTerm" type="text"/>
                        <label for="txtAmount" class="col-form-label">Amount:</label>
                        <input class="form-control" id="txtAmount" type="text"/>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" onclick="newLoanRequest()">Request Loan</button>
            </div>
        </div>
    </div>
</div>

<div id="spinnerDialog" class="modal" tabIndex="-1" data-bs-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <div class="d-flex align-items-center">
                    <div class="spinner-border" role="status"></div>
                    <span id="spinnerDialogMessage" style="padding-left: 15px">Loading ...</span>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
    <div id="eventsToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
        <div class="toast-header">
            <strong class="me-auto">New quotes response</strong>
            <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
        </div>
        <div class="toast-body"><span id="toastMessage"><!-- Filled in by app.js --></span></div>
    </div>
</div>

<script src="/webjars/jquery/jquery.min.js"></script>
<script src="/webjars/bootstrap/js/bootstrap.min.js"></script>
<script src="/app.js"></script>

</body>
</html>